<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>C MIP-SDK: mip_sdk_interface.h Source File</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />

<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>

</head>
<body>
<div id="top"><!-- do not remove this div! -->


<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">C MIP-SDK
   
   </div>
   
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.7.5.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>Globals</span></a></li>
    </ul>
  </div>
<div class="header">
  <div class="headertitle">
<div class="title">mip_sdk_interface.h</div>  </div>
</div>
<div class="contents">
<a href="mip__sdk__interface_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 
<a name="l00002"></a>00002 <span class="comment">//</span>
<a name="l00006"></a>00006 <span class="comment"></span><span class="comment">//</span>
<a name="l00009"></a>00009 <span class="comment"></span><span class="comment">//</span>
<a name="l00010"></a>00010 <span class="comment">// External dependencies:</span>
<a name="l00011"></a>00011 <span class="comment">//</span>
<a name="l00012"></a>00012 <span class="comment">//  </span>
<a name="l00013"></a>00013 <span class="comment">// </span>
<a name="l00015"></a>00015 <span class="comment"></span><span class="comment">//</span>
<a name="l00018"></a>00018 <span class="comment"></span><span class="comment">//</span>
<a name="l00028"></a>00028 <span class="comment"></span><span class="comment">//</span>
<a name="l00030"></a>00030 <span class="comment"></span>
<a name="l00031"></a>00031 <span class="preprocessor">#ifndef _MIP_SDK_INTERFACE_H</span>
<a name="l00032"></a>00032 <span class="preprocessor"></span><span class="preprocessor">#define _MIP_SDK_INTERFACE_H</span>
<a name="l00033"></a>00033 <span class="preprocessor"></span>
<a name="l00034"></a>00034    
<a name="l00036"></a>00036 <span class="comment">//</span>
<a name="l00037"></a>00037 <span class="comment">//Include Files</span>
<a name="l00038"></a>00038 <span class="comment">//</span>
<a name="l00040"></a>00040 <span class="comment"></span>
<a name="l00041"></a>00041 <span class="preprocessor">#include &quot;<a class="code" href="mip_8h.html">mip.h</a>&quot;</span>
<a name="l00042"></a>00042 <span class="preprocessor">#include &quot;<a class="code" href="mip__sdk__config_8h.html">mip_sdk_config.h</a>&quot;</span>
<a name="l00043"></a>00043 <span class="preprocessor">#include &quot;<a class="code" href="mip__sdk__user__functions_8h.html">mip_sdk_user_functions.h</a>&quot;</span>
<a name="l00044"></a>00044 <span class="preprocessor">#include &quot;<a class="code" href="ring__buffer_8h.html">ring_buffer.h</a>&quot;</span>
<a name="l00045"></a>00045 <span class="preprocessor">#include &quot;<a class="code" href="byteswap__utilities_8h.html">byteswap_utilities.h</a>&quot;</span>
<a name="l00046"></a>00046 
<a name="l00048"></a>00048 <span class="comment">//</span>
<a name="l00049"></a>00049 <span class="comment">// Defines</span>
<a name="l00050"></a>00050 <span class="comment">//</span>
<a name="l00052"></a>00052 <span class="comment"></span>
<a name="l00054"></a>00054 
<a name="l00055"></a>00055 <span class="preprocessor">#define MIP_INTERFACE_INPUT_RING_BUFFER_SIZE MIP_MAX_PACKET_SIZE</span>
<a name="l00056"></a>00056 <span class="preprocessor"></span>
<a name="l00057"></a>00057 
<a name="l00058"></a>00058 <span class="preprocessor">#define MIP_INTERFACE_CALLBACK_VALID_PACKET   0</span>
<a name="l00059"></a>00059 <span class="preprocessor"></span><span class="preprocessor">#define MIP_INTERFACE_CALLBACK_CHECKSUM_ERROR 1</span>
<a name="l00060"></a>00060 <span class="preprocessor"></span><span class="preprocessor">#define MIP_INTERFACE_CALLBACK_TIMEOUT        2</span>
<a name="l00061"></a>00061 <span class="preprocessor"></span>
<a name="l00062"></a>00062 <span class="preprocessor">#define MIP_INTERFACE_OK    0</span>
<a name="l00063"></a>00063 <span class="preprocessor"></span><span class="preprocessor">#define MIP_INTERFACE_ERROR 1</span>
<a name="l00064"></a>00064 <span class="preprocessor"></span>
<a name="l00065"></a>00065 <span class="preprocessor">#define MIP_INTERFACE_TIMEOUT    0</span>
<a name="l00066"></a>00066 <span class="preprocessor"></span><span class="preprocessor">#define MIP_INTERFACE_NO_TIMEOUT 1</span>
<a name="l00067"></a>00067 <span class="preprocessor"></span>
<a name="l00068"></a>00068 <span class="preprocessor">#define MIP_INTERFACE_INITIALIZED   1</span>
<a name="l00069"></a>00069 <span class="preprocessor"></span><span class="preprocessor">#define MIP_INTERFACE_UNINITIALIZED 0</span>
<a name="l00070"></a>00070 <span class="preprocessor"></span>
<a name="l00071"></a>00071 <span class="keyword">typedef</span> void (*parser_callback_ptr)(<span class="keywordtype">void</span>*, u8*, u16, u8);
<a name="l00072"></a>00072 
<a name="l00073"></a>00073 
<a name="l00075"></a>00075 <span class="comment">//</span>
<a name="l00076"></a>00076 <span class="comment">// Structures</span>
<a name="l00077"></a>00077 <span class="comment">//</span>
<a name="l00079"></a>00079 <span class="comment"></span>
<a name="l00080"></a><a class="code" href="struct__mip__interface.html">00080</a> <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="struct__mip__interface.html">_mip_interface</a>
<a name="l00081"></a>00081 {
<a name="l00082"></a>00082  <span class="comment">//State</span>
<a name="l00083"></a>00083  u8 state;
<a name="l00084"></a>00084  
<a name="l00085"></a>00085  <span class="comment">//Port Handle</span>
<a name="l00086"></a>00086  <span class="keywordtype">void</span> *port_handle;
<a name="l00087"></a>00087    
<a name="l00088"></a>00088  <span class="comment">//Input Ring Buffer</span>
<a name="l00089"></a>00089  <a class="code" href="struct__ring__buffer.html">ring_buffer</a> input_buffer;
<a name="l00090"></a>00090  u8          input_buffer_bytes[MIP_INTERFACE_INPUT_RING_BUFFER_SIZE]; 
<a name="l00091"></a>00091 
<a name="l00092"></a>00092  <span class="comment">//MIP Packet Parser variables</span>
<a name="l00093"></a>00093  u8  mip_packet[MIP_MAX_PACKET_SIZE];
<a name="l00094"></a>00094  u16 mip_packet_byte_count; 
<a name="l00095"></a>00095  u32 parser_start_time; 
<a name="l00096"></a>00096  u32 parser_num_bad_checksums;
<a name="l00097"></a>00097  u32 parser_timeouts;
<a name="l00098"></a>00098  u8  parser_in_sync;
<a name="l00099"></a>00099  u32 parser_headers_skipped;
<a name="l00100"></a>00100 
<a name="l00101"></a>00101  u32 packet_timeout;
<a name="l00102"></a>00102  
<a name="l00103"></a>00103  <span class="comment">//Command/Response Variables</span>
<a name="l00104"></a>00104  u8  command_response_received;
<a name="l00105"></a>00105  u8  command_id;
<a name="l00106"></a>00106  u8  command_acknack_response;
<a name="l00107"></a>00107  u8 *command_response_data;
<a name="l00108"></a>00108  u8  command_response_data_size;
<a name="l00109"></a>00109  
<a name="l00110"></a>00110  <span class="comment">//Callback variables</span>
<a name="l00111"></a>00111  u8                  callback_data_set_list[MIP_INTERFACE_MAX_CALLBACKS + 1];
<a name="l00112"></a>00112  parser_callback_ptr callback_function_list[MIP_INTERFACE_MAX_CALLBACKS + 1];
<a name="l00113"></a>00113  <span class="keywordtype">void</span>               *callback_user_ptr_list[MIP_INTERFACE_MAX_CALLBACKS + 1];
<a name="l00114"></a>00114  
<a name="l00115"></a>00115 }<a class="code" href="struct__mip__interface.html">mip_interface</a>;   
<a name="l00116"></a>00116 
<a name="l00117"></a>00117 
<a name="l00119"></a>00119 <span class="comment">//</span>
<a name="l00120"></a>00120 <span class="comment">// Function Prototypes</span>
<a name="l00121"></a>00121 <span class="comment">//</span>
<a name="l00123"></a>00123 <span class="comment"></span>
<a name="l00124"></a>00124 u16 <a class="code" href="mip__sdk__interface_8h.html#a8348893a39d9c02d535bc0c2a92617e0">mip_interface_init</a>(u32 com_port, u32 baudrate, <a class="code" href="struct__mip__interface.html">mip_interface</a> *device_interface, u32 packet_timeout_val);
<a name="l00125"></a>00125 u16 <a class="code" href="mip__sdk__interface_8h.html#a865238514ffa638e58aacc29bde2242a">mip_interface_close</a>(<a class="code" href="struct__mip__interface.html">mip_interface</a> *device_interface);
<a name="l00126"></a>00126 
<a name="l00127"></a>00127 u16 <a class="code" href="mip__sdk__interface_8h.html#aa7e3e36fb2524f2b47b374fbc5c98acf">mip_interface_add_descriptor_set_callback</a>(<a class="code" href="struct__mip__interface.html">mip_interface</a> *device_interface, u8 data_set, <span class="keywordtype">void</span> *user_ptr, <span class="keywordtype">void</span> (*packet_callback)(<span class="keywordtype">void</span> *user_ptr, u8 *packet, u16 packet_size, u8 callback_type));
<a name="l00128"></a>00128 u16 <a class="code" href="mip__sdk__interface_8h.html#aae7f32dd10e2150ccc46e80542e5953d">mip_interface_delete_descriptor_set_callback</a>(<a class="code" href="struct__mip__interface.html">mip_interface</a> *device_interface, u8 data_set);
<a name="l00129"></a>00129 
<a name="l00130"></a>00130 u16 <a class="code" href="mip__sdk__interface_8h.html#a5c80b43dbac9dfcbc2d5a6458d5fe21c">mip_interface_update</a>(<a class="code" href="struct__mip__interface.html">mip_interface</a> *device_interface);
<a name="l00131"></a>00131 
<a name="l00132"></a>00132 u16 <a class="code" href="mip__sdk__interface_8h.html#a47d437db123ec316511aad8cfdf4f0e9">mip_interface_send_command</a>(<a class="code" href="struct__mip__interface.html">mip_interface</a> *device_interface, u8 command_set, u8 command_descriptor, u8 *command_data, 
<a name="l00133"></a>00133                                u16 command_data_size, u8 wait_for_response, u32 timeout_ms);
<a name="l00134"></a>00134                                
<a name="l00135"></a>00135 u16 <a class="code" href="mip__sdk__interface_8h.html#a86b01de54ff1b8085b099e916d757038">mip_interface_send_preformatted_command</a>(<a class="code" href="struct__mip__interface.html">mip_interface</a> *device_interface, u8 *command, u16 command_size, u8 wait_for_response, u32 timeout_ms);
<a name="l00136"></a>00136 
<a name="l00137"></a>00137 u16 <a class="code" href="mip__sdk__interface_8h.html#a886f509e0555dcc9f101a4828b118af6">mip_interface_send_command_with_response</a>(<a class="code" href="struct__mip__interface.html">mip_interface</a> *device_interface, u8 command_set, u8 command_descriptor, u8 *command_data, 
<a name="l00138"></a>00138                                              u16 command_data_size, u8 **response_data, u16 *response_data_size, u32 timeout_ms);
<a name="l00139"></a>00139                                              
<a name="l00140"></a>00140 u16 <a class="code" href="mip__sdk__interface_8h.html#a317f6595f35da8090f34c39f19b58a2d">mip_interface_send_preformatted_command_with_response</a>(<a class="code" href="struct__mip__interface.html">mip_interface</a> *device_interface, u8 *command, u16 command_size, 
<a name="l00141"></a>00141                                                           u8 **response_data, u16 *response_data_size, u32 timeout_ms);
<a name="l00142"></a>00142 
<a name="l00143"></a>00143 
<a name="l00144"></a>00144 u16 <a class="code" href="mip__sdk__interface_8h.html#aaa02ad5b56c5a90dd0fb2b6a6e62a408">mip_interface_write</a>(<a class="code" href="struct__mip__interface.html">mip_interface</a> *device_interface, u8 *data, u32 num_bytes, u32 *bytes_written);
<a name="l00145"></a>00145 u16 <a class="code" href="mip__sdk__interface_8h.html#a2f56f7f1ef4d3d620d5415bb880c26d2">mip_interface_write_blocking</a>(<a class="code" href="struct__mip__interface.html">mip_interface</a> *device_interface, u8 *data, u32 num_bytes, u32 *bytes_written, u32 timeout_ms);
<a name="l00146"></a>00146 
<a name="l00147"></a>00147 u16 <a class="code" href="mip__sdk__interface_8h.html#a0f31c0a8a19cf411d3b0cbfeac64fd25">__mip_interface_parse_input_buffer</a>(<a class="code" href="struct__mip__interface.html">mip_interface</a> *device_interface);
<a name="l00148"></a>00148 u16 <a class="code" href="mip__sdk__interface_8h.html#ab2649a0821d41047afe3fbcaee69f0b9">__mip_interface_find_callback</a>(<a class="code" href="struct__mip__interface.html">mip_interface</a> *device_interface, u8 data_set, <span class="keywordtype">void</span> **callback_user_ptr, parser_callback_ptr *callback_function);
<a name="l00149"></a>00149 u16 <a class="code" href="mip__sdk__interface_8h.html#a91c210b9527322da462f0ad57a96880f">__mip_interface_time_timeout</a>(u32 initial_time, u32 timeout_ms);
<a name="l00150"></a>00150 
<a name="l00151"></a>00151 u16  <a class="code" href="mip__sdk__interface_8h.html#a3e6100be0b513b61c7a0495e4a079a87">__mip_interface_wait_for_response</a>(<a class="code" href="struct__mip__interface.html">mip_interface</a> *device_interface, u8 command_set, u8 command_descriptor, u8 *acknack_response, u8 **response_data, u16 *response_data_size, u32 timeout_ms);
<a name="l00152"></a>00152 <span class="keywordtype">void</span> <a class="code" href="mip__sdk__interface_8h.html#a761cb54740a05b849a2ab10b162ec629">__mip_interface_command_response_handler</a>(<span class="keywordtype">void</span> *user_ptr, u8 *packet, u16 packet_size, u8 callback_type);
<a name="l00153"></a>00153 
<a name="l00154"></a>00154 
<a name="l00155"></a>00155 <span class="preprocessor">#endif</span>
</pre></div></div>
</div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Data Structures</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Defines</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>



<hr class="footer"/><address class="footer"><small>
Generated on Fri May 30 2014 17:03:33 for C MIP-SDK by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.5.1
</small></address>

</body>
</html>
